<template>
<!-- 1.0新闻详情 -->
	<div id="tml">
		<div id="title">
			<h3 v-text = 'info.title'></h3>
			<p>{{info.add_time | datefmt('YYYY-MM-DD')}}   {{info.click}}次浏览</p>
		</div>
		<div id="content" v-html = 'info.content'>
			
		</div>
		<!-- 评论组件的集成 -->
		<comment :id ='id'></comment>	
	</div>

</template>
<script>
// 导入评论组件
import comment from '../subcom/comment.vue'
	export default{
		components:{
			comment  //定义评论组件
		},
		data(){
			return {
				id:0,
				info:{

				}
			}
		},
		created(){
			this.id = this.$route.params.newsid;
			this.getinfo();
		},
		methods:{
			getinfo(){
				var url = this.$common.apidomain+'/api/getnew/'+this.id;

				this.$http.get(url).then(function (res) {
					var com = res.body;
					if(com.status!=0){
						this.$common.Toast(com.messge);
					}
					this.info = com.message[0];
				})
			}
		}


	}
</script>
<style scoped>
	#title h3{
		color: #0094ff;
	}
	#title p{
		color:rgba(0,0,0,0.5);
	}

	#title,#content{
		padding: 5px;
	}
</style>